package com.woniuxy01;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Test02 {
    public static void main(String[] args) {
        LocalDateTime dateTime = LocalDateTime.now();
        //日期换行
        //LocalDateTime--->String
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        System.out.println(dateTime);
        System.out.println(dtf.format(dateTime));
        String str="2020-12-09 11:19:43";
        LocalDateTime dateTime2 = LocalDateTime.parse(str, dtf);
        System.out.println(dateTime2);
        System.out.println(dtf.format(dateTime2));
    }
}
